package org.getOffer.offer09;

import java.util.LinkedList;

/**
 * @Author: wjy
 * @Date: 2021/12/3 15:09
 */
public class Solution {

    public static void main(String[] args) {

    }

    LinkedList<Integer> A, B;

    public Solution() {
        A = new LinkedList<Integer>();
        B = new LinkedList<Integer>();
    }

    public void appendTail(int value) {
        A.addLast(value);
    }

    public int deleteHead() {
        if(!B.isEmpty()) return B.removeLast();
        if(A.isEmpty()) return -1;
        while(!A.isEmpty())
            B.addLast(A.removeLast());
        return B.removeLast();
    }

}
